<template>
  <div class="app">
    <div v-for="(item, index) in getnewslistData" :key="index" class="taowenValueBox" @click="wenDetails(item.id)">
      <img :src="item.img_url" alt="" class="taowenImg"/>
      <div>
          <span class="taowenTitle">{{ item.title }}</span>
          <span class="taowenTime">{{item.add_time | date}}</span>
          <span class="taowenClick">点击次数:{{item.click}}</span>
      </div>
      
    </div>
  </div>
</template>

<script>
import { getnewslist } from "@/api/taowenApi.js";
export default {
  data() {
    return {
      getnewslistData: "",
    };
  },
  methods: {
    async getnewslistAxios() {
      let { data } = await getnewslist(1, 10);
      this.getnewslistData = data.message;
    },
    wenDetails(id){
        this.$router.push(`/taowendetails?id=${id}`)
    }
  },

  created() {
    this.getnewslistAxios();
  },
};
</script>

<style lang="scss" scoped>

$ui-width: 720;
$num: 15;
$baseFontSize: 50; // 750 / 15
@function px2rem($px) {
  @return $px / $baseFontSize + rem;
}

.app{
    background-color: #f0f0f0d3;
}

.taowenValueBox{
    display: flex;
    font-size: px2rem(16);
    width: 70%;
    border-bottom: 1px solid #ccc;
    padding: 7px;
    .taowenImg{
        width: px2rem(80);
        height: px2rem(80);
    }

    div{
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    margin-left: 6px;
    .taowenTitle{
        display: inline-block;
        width: 100%;
        align-self: flex-start;
    }

    }
}


</style>